Skip to content

fix: exempt bundled dist artifacts from no-cloud self-scan (0.4.2)#14

Closed
andrei-hasna wants to merge 1 commit into
mainfrom
fix/no-cloud-self-scan-dist
Closed

fix: exempt bundled dist artifacts from no-cloud self-scan (0.4.2)#14
andrei-hasna wants to merge 1 commit into
mainfrom
fix/no-cloud-self-scan-dist

Conversation

@andrei-hasna

Copy link
Copy Markdown
Contributor

Problem

@hasna/contracts failed its own no_cloud_guard conformance check (and bun test had 3 failures). The no-cloud scanner whitelisted a hardcoded set of dist/ files carrying the forbidden-runtime pattern strings as bundled declaration literals. When service-contract, mode, and conformance were added as build entrypoints, the bundler inlined those declarations into their dist outputs, but the whitelist was not updated — so the package flagged itself.

Fix

Match the two declaration source modules (src/no-cloud.ts, src/schemas.ts) explicitly and treat any dist/ build artifact generically. Still gated by the >=2 declaration-marker check and the @hasna/contracts package guard, so downstream packages cannot bypass the scan.

Also bumped CONTRACTS_PACKAGE_VERSION to 0.4.2 to match package.json (caught by the dist smoke test).

Verification

  • bun run verify:release green: typecheck, 142 tests (0 fail), conformance, build, dist smoke, pack.
  • Published @hasna/contracts@0.4.2; fresh bun add resolves and the published CLI self-scan returns verdict: passed.

The no-cloud scanner whitelisted a hardcoded set of dist/ files that carry
the forbidden-runtime pattern strings as bundled declaration literals. When
service-contract, mode, and conformance were added as build entrypoints, the
bundler inlined those declarations into their dist outputs, but the whitelist
was not updated, so the package failed its own no_cloud_guard conformance
check. Match the two declaration source modules explicitly and treat any dist/
build artifact generically, still gated by the >=2 declaration-marker check
and the @hasna/contracts package guard so downstream packages cannot bypass.
@andrei-hasna

Copy link
Copy Markdown
Contributor Author

Closing as superseded / already fixed on main.

The self-scan failure this PR fixes (0.4.2) is already resolved on main (now at 0.5.3; npm latest 0.5.2). Main took the alternative route of expanding the explicit CONTRACTS_DECLARATION_PATHS whitelist to cover the new dist entrypoints (dist/mode.js, dist/service-contract.js, dist/conformance.js, dist/client/transport.js, dist/client/storage.js and their .d.ts), rather than this PR's generic dist/ matching.

Verified locally on origin/main: bun test 218 pass / 0 fail; no-cloud-scan returns ok on the source tree, built dist, and packed tarball; conformance green. So the bug is gone.

This branch is also 3 minor versions behind (bumps to 0.4.2 vs main 0.5.3) and is in a CONFLICTING/DIRTY state; merging would regress the version. The generic dist/ approach is a reasonable robustness improvement but is not required for correctness and can be re-proposed cleanly against current main if desired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant